Skip to content

chore: remove duplicate messenger files now in chat-system#167

Merged
rexlunae merged 4 commits intomainfrom
remove-duplicate-messengers
Apr 13, 2026
Merged

chore: remove duplicate messenger files now in chat-system#167
rexlunae merged 4 commits intomainfrom
remove-duplicate-messengers

Conversation

@rexlunae
Copy link
Copy Markdown
Owner

@rexlunae rexlunae commented Apr 13, 2026

Summary

Remove 11 duplicate messenger implementation files that are already in the chat-system crate and were dead code (mod.rs re-exports from chat-system).

Removed Files

  • console.rs
  • discord.rs
  • google_chat.rs
  • imessage.rs
  • irc.rs
  • matrix.rs
  • slack.rs
  • teams.rs
  • telegram.rs
  • webhook.rs
  • whatsapp.rs

Still TODO

The *_cli.rs files are kept for now because they have RustyClaw-specific bug fixes that need to be backported to chat-system first:

Also kept:

  • media.rs — media handling utilities
  • streaming.rs — stream buffer/config
  • group_chat.rs — group chat config

These may be RustyClaw-specific or need evaluation for chat-system migration.

-2,202 lines deleted 🧹

Fixes #166 (partial)


Open with Devin

These messenger implementations are already in the chat-system crate
and were not being used (mod.rs re-exports from chat-system).

Removed files:
- console.rs
- discord.rs
- google_chat.rs
- imessage.rs
- irc.rs
- matrix.rs
- slack.rs
- teams.rs
- telegram.rs
- webhook.rs
- whatsapp.rs

Note: *_cli.rs files kept for now as they have RustyClaw-specific
fixes that need to be backported to chat-system.

Fixes #166 (partial)
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Remove telegram_cli.rs, discord_cli.rs, slack_cli.rs - these were
never used in the codebase. Use TelegramMessenger, DiscordMessenger,
SlackMessenger from chat-system instead.

MatrixCliMessenger kept temporarily because it has features not yet
in chat-system's MatrixMessenger:
- with_state_dir (sync token persistence)
- with_allowed_chats (room filtering)
- with_dm_config (DM handling)

These need to be upstreamed to chat-system before MatrixCliMessenger
can be removed.

Removes ~24KB of dead code.

Fixes #166 (continued)
chat-system 0.1.3 now includes all MatrixCliMessenger capabilities:
- with_state_dir() for sync token persistence
- with_allowed_chats() for room filtering
- with_dm_config() for DM handling

Changes:
- Bump chat-system to 0.1.3
- Remove matrix_cli.rs (779 lines)
- Remove matrix-cli feature flag
- Update build_matrix_messenger() with new capabilities
- Deprecate "matrix-cli" messenger type (use "matrix" instead)
- Update all-messengers to use matrix instead of matrix-cli

Completes #166
devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 7 additional findings in Devin Review.

Open in Devin Review

Comment on lines +380 to +400
// Set state directory for sync token persistence
if let Some(dirs) = directories::ProjectDirs::from("", "", "rustyclaw") {
let state_dir = dirs.data_dir().join("matrix").join(&name);
messenger = messenger.with_state_dir(state_dir);
}

// Set allowed chats if configured
if !config.allowed_chats.is_empty() {
messenger = messenger.with_allowed_chats(config.allowed_chats.clone());
}

// Set DM config if present
if let Some(ref dm) = config.dm {
use crate::messengers::MatrixDmConfig;
let dm_config = MatrixDmConfig {
enabled: dm.enabled,
policy: dm.policy.clone().unwrap_or_else(|| "allowlist".to_string()),
allow_from: dm.allow_from.clone(),
};
messenger = messenger.with_dm_config(dm_config);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Password-based Matrix configs bypass build_matrix_messenger, silently losing state_dir/allowed_chats/dm_config

The pre-existing generic_messenger_config function at crates/rustyclaw-core/src/gateway/messenger_handler.rs:198-215 has a "matrix" if config.access_token.is_none() arm that intercepts all password-based Matrix configs and routes them through GenericMessenger, returning early at line 84-87 before build_matrix_messenger is ever called. This means the new state_dir, allowed_chats, and dm_config setup code (lines 380-400) — migrated from the deleted MatrixCliMessenger — is only reached when access_token is set. Users migrating from matrix-cli to matrix type with password auth silently lose: (1) sync token persistence (causing re-processing of old messages on restart), (2) room allowlisting (bot responds in all rooms), and (3) DM handling configuration.

Prompt for agents
The build_matrix_messenger function (lines 349-403) adds state_dir, allowed_chats, and dm_config setup for MatrixMessenger, but this code is never reached for password-based Matrix configs. The reason is generic_messenger_config (line 198) has a match arm for "matrix" if config.access_token.is_none() that creates a GenericMessenger and returns early from create_messenger at line 84-87, bypassing build_matrix_messenger entirely.

To fix this, either:
1. Remove the "matrix" arm from generic_messenger_config (lines 198-215) so that all Matrix configs go through build_matrix_messenger, OR
2. Move the state_dir/allowed_chats/dm_config logic into the generic_messenger_config path for Matrix (though this may not be possible if GenericMessenger doesn't support those builder methods), OR
3. Add a guard condition to the generic_messenger_config "matrix" arm that also checks for allowed_chats/dm being set, falling through to build_matrix_messenger when those advanced features are configured.

Option 1 is the simplest and most correct approach given the PR's intent to consolidate matrix-cli features into the matrix type.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 82bb28d. Removed the "matrix" if config.access_token.is_none() arm from generic_messenger_config so all Matrix configs (both access_token and password-based) now go through build_matrix_messenger, which correctly applies state_dir, allowed_chats, and dm_config.

@rexlunae rexlunae merged commit 289a1e1 into main Apr 13, 2026
16 checks passed
devin-ai-integration bot added a commit that referenced this pull request Apr 13, 2026
Remove the 'matrix' arm from generic_messenger_config that intercepted
password-based Matrix configs and routed them through GenericMessenger.
This caused state_dir, allowed_chats, and dm_config setup to be silently
skipped for password-auth Matrix users.

Now all Matrix configs (both access_token and password) go through
build_matrix_messenger, which already handles both auth modes and
correctly applies state_dir, allowed_chats, and dm_config.

Fixes Devin Review finding on PR #167.

Co-Authored-By: Erica Stith <rexlunae@gmail.com>
devin-ai-integration bot added a commit that referenced this pull request Apr 13, 2026
Remove the 'matrix' arm from generic_messenger_config that intercepted
password-based Matrix configs and routed them through GenericMessenger.
This caused state_dir, allowed_chats, and dm_config setup to be silently
skipped for password-auth Matrix users.

Now all Matrix configs (both access_token and password) go through
build_matrix_messenger, which already handles both auth modes and
correctly applies state_dir, allowed_chats, and dm_config.

Fixes Devin Review finding on PR #167.

Co-Authored-By: Erica Stith <rexlunae@gmail.com>
rexlunae added a commit that referenced this pull request Apr 13, 2026
Remove the 'matrix' arm from generic_messenger_config that intercepted
password-based Matrix configs and routed them through GenericMessenger.
This caused state_dir, allowed_chats, and dm_config setup to be silently
skipped for password-auth Matrix users.

Now all Matrix configs (both access_token and password) go through
build_matrix_messenger, which already handles both auth modes and
correctly applies state_dir, allowed_chats, and dm_config.

Fixes Devin Review finding on PR #167.

Co-Authored-By: Erica Stith <rexlunae@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove built-in messenger code in favor of chat-system crate

1 participant